<?php
/*
 * PHP versions 4 and 5
 *
 * dAuth: A secure authentication system for the cakePHP framework.
 * Copyright (c)    2006, Dieter Plaetinck
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @author            Dieter Plaetinck
 * @copyright        Copyright (c) 2006, Dieter Plaetinck
 * @version            0.3
 * @modifiedby        Dieter@be
 * @lastmodified    $Date: 2006-12-04 16:18:00 +0000 (Mon, 4 Dec 2006) $
 * @license            http://www.opensource.org/licenses/mit-license.php The MIT License
 */
class User extends AppModel
{
    var $name = 'User';
    var $displayField = 'username';

    var $validate = array(
        'username'    => '/[a-z0-9\_\-]{3,}$/i',
        'email'     => VALID_EMAIL,
        'password'    => VALID_NOT_EMPTY
    );

    function changePassword ($id = null, $hash = null)
    {
        $success = false;
        if ($id && $hash)
        {
            $this->id = $id;
            $success = $this->saveField('password', $hash);
        }
        return $success;
    }
}
?>